package com.imc.griebeler.visitor;

public class AreaVisitor implements ShapeVisitor<Double>{

	@Override
	public Double visit(Circle circle) {
		return Math.PI * Math.pow(circle.getRadius(), 2);
	}

	@Override
	public Double visit(Rectangle rectangle) {
		return new Double(rectangle.getWidth() * rectangle.getWidth());
	}

	@Override
	public Double visit(Triangle triangle) {
		return (triangle.getWidth() * 0.5) * triangle.getHeight();
	}
}
